import { Injectable } from "@nestjs/common";

@Injectable()
export class StudentService{
    //模拟数据库储存用户数据
    private users=[
        {id:1,name:'张三'},
        {id:2,name:'李四'},
    ];
    //获取所有学生信息
    findAll(){
        return this.users;
    }

    //根据id获取用户
    findOne(id:number){
        return this.users.find(user=>user.id===id);
    }

}